﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class SalaryDataDetailsControllerBase : Controller{
	public SalaryDataDetailsControllerBase()
		: base()
	{
	}
	private static SalaryDataDetailsDAO _Service; 
	public static SalaryDataDetailsDAO Service{
		get{
			if(_Service==null)
				_Service = new SalaryDataDetailsDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public SalaryDataDetailsEntity MapDataRowToObject(DataRow row){
		SalaryDataDetailsEntity o = new SalaryDataDetailsEntity();
		 if(!row.IsNull("SalaryFieldId"))
			o.SalaryFieldId=ConvertInt(row["SalaryFieldId"]);
		 if(!row.IsNull("DateInput"))
			o.DateInput=ConvertDateTime(row["DateInput"]);
		 o.Note=Convert.ToString(row["Note"]);
		 if(!row.IsNull("SalaryData"))
			o.SalaryData=ConvertNumber(row["SalaryData"]);
		 if(!row.IsNull("UserId"))
			o.UserId=ConvertInt(row["UserId"]);
		 if(!row.IsNull("PersonId"))
			o.PersonId=(Int32)(row["PersonId"]);
		 if(!row.IsNull("SalaryDataDetailId"))
		    o.SalaryDataDetailId=(Int32)(row["SalaryDataDetailId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(SalaryDataDetailsEntity o,DataRow row){
		row["SalaryFieldId"]=o.SalaryFieldId;
		row["DateInput"]=o.DateInput;
		row["Note"]=o.Note;
		row["SalaryData"]=o.SalaryData;
		row["UserId"]=o.UserId;
		row["PersonId"]=o.PersonId;
		row["SalaryDataDetailId"]=o.SalaryDataDetailId;
    }
}
}
